Manages the scripts available in the component.
More...
Manages the scripts available in the component.
The manager always owns the memory allocated through it. External code should never call delete on memory retrieved through it.
◆ createOrRetrieve()
Script* nkScripts::ScriptManager::createOrRetrieve |
( |
const std::string_view & |
name | ) |
|
Creates if unavailable, or retrieves if available, a script given its name.
- Parameters
-
name | The name of the script to create or retrieve. |
- Returns
- The script, possibly newly created.
◆ get()
Script* nkScripts::ScriptManager::get |
( |
const std::string_view & |
name | ) |
|
Gets an existing script.
- Parameters
-
name | The name of the script to retrieve. |
- Returns
- The script attached to given name if available, nullptr if unavailable.
◆ getByIndex()
Script* nkScripts::ScriptManager::getByIndex |
( |
unsigned int |
id | ) |
|
Gets a script according to an index.
- Parameters
-
id | The index to search for. |
- Returns
- The script linked to given index if available, nullptr if unavailable.
◆ rename()
void nkScripts::ScriptManager::rename |
( |
const std::string_view & |
currentName, |
|
|
const std::string_view & |
newName |
|
) |
| |
Renames a script within memory.
- Parameters
-
currentName | The current name to find back the script to alter. |
newName | The new name to assign to the script. |
◆ erase()
void nkScripts::ScriptManager::erase |
( |
const std::string_view & |
name | ) |
|
Erases a script, and free its memory.
- Parameters
-
name | The name of the script to erase. |
The documentation for this class was generated from the following file: